# implementation of DataSource for writing to the local file system
class LocalDataSource < DataSource
  attr_accessor :path

  def initialize path = nil
    @path = ( path || File.expand_path('.') )
  end

  def write relative_path, data
    full_path = File.join @path, relative_path
    dir_path  = File.dirname full_path
    FileUtils.mkdir_p dir_path unless File.directory?dir_path
    File.open( full_path, 'w' ){|f| f << data }
  end

end
